package com.cssy.xxkj.logic.dao.impl;

import java.util.List;

import org.springframework.dao.DataAccessException;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.cssy.xxkj.logic.dao.LogicWhCheckTaskItemDAO;
import com.cssy.xxkj.logic.entity.InOutBillDO;
import com.cssy.xxkj.logic.entity.LogicWhCheckTaskItemDO;
import com.plat.helper.SearchConditions;

/**
 * 数据访问对象实现类
 * @since 2014-09-30
 */
public class LogicWhCheckTaskItemDAOImpl extends SqlMapClientDaoSupport implements LogicWhCheckTaskItemDAO {

    /**
     * 插入数据
     * @param logicWhCheckTaskItemDO
     * @return 插入数据的主键
     */
    public String insertLogicWhCheckTaskItemDO(LogicWhCheckTaskItemDO logicWhCheckTaskItemDO) throws DataAccessException {
        Object id = getSqlMapClientTemplate().insert("LogicWhCheckTaskItem.insert", logicWhCheckTaskItemDO);
        return (String) id;
    }

    /**
     * 统计记录数
     * @param logicWhCheckTaskItemDO
     * @return 查出的记录数
     */
    public Integer countLogicWhCheckTaskItemDOByExample(LogicWhCheckTaskItemDO logicWhCheckTaskItemDO) throws DataAccessException {
        Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicWhCheckTaskItem.countByDOExample", logicWhCheckTaskItemDO);
        return count;
    }

    /**
     * 更新记录
     * @param logicWhCheckTaskItemDO
     * @return 受影响的行数
     */
    public Integer updateLogicWhCheckTaskItemDO(LogicWhCheckTaskItemDO logicWhCheckTaskItemDO) throws DataAccessException {
        int result = getSqlMapClientTemplate().update("LogicWhCheckTaskItem.update", logicWhCheckTaskItemDO);
        return result;
    }

    /**
     * 获取对象列表
     * @param logicWhCheckTaskItemDO
     * @return 对象列表
     */
    @SuppressWarnings("unchecked")
    public List<LogicWhCheckTaskItemDO> findListByExample(LogicWhCheckTaskItemDO logicWhCheckTaskItemDO) throws DataAccessException {
        List<LogicWhCheckTaskItemDO> list = getSqlMapClientTemplate().queryForList("LogicWhCheckTaskItem.findListByDO", logicWhCheckTaskItemDO);
        return list;
    }

    /**
     * 根据主键获取logicWhCheckTaskItemDO
     * @param id
     * @return logicWhCheckTaskItemDO
     */
    public LogicWhCheckTaskItemDO findLogicWhCheckTaskItemDOByPrimaryKey(String id) throws DataAccessException {
        LogicWhCheckTaskItemDO logicWhCheckTaskItemDO = (LogicWhCheckTaskItemDO) getSqlMapClientTemplate().queryForObject("LogicWhCheckTaskItem.findByPrimaryKey", id);
        return logicWhCheckTaskItemDO;
    }

    /**
     * 删除记录
     * @param id
     * @return 受影响的行数
     */
    public Integer deleteLogicWhCheckTaskItemDOByPrimaryKey(String id) throws DataAccessException {
        Integer rows = (Integer) getSqlMapClientTemplate().delete("LogicWhCheckTaskItem.deleteByPrimaryKey", id);
        return rows;
    }

	@SuppressWarnings("unchecked")
	@Override
	public List<LogicWhCheckTaskItemDO> findItemByCheckTaskID(String taskID)
			throws DataAccessException {
		return getSqlMapClientTemplate().queryForList("LogicWhCheckTaskItem_ex.findListByTaskID", taskID);
	}

	@Override
	public Integer deleteWhCheckId(String id) throws DataAccessException {
		Integer rows = (Integer) getSqlMapClientTemplate().delete("LogicWhCheckTaskItem_ex.deleteWhCheckId", id);
        return rows;
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<LogicWhCheckTaskItemDO> find(SearchConditions scs)
			throws DataAccessException {
		return getSqlMapClientTemplate().queryForList("LogicWhCheckTaskItem_ex.find", scs);
	}

	@Override
	public Integer count(SearchConditions scs) throws DataAccessException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Integer deleteBizRemoved(String id) throws DataAccessException {
		// TODO Auto-generated method stub
		return null;
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<InOutBillDO> findCheckTaskList(SearchConditions scs)
			throws DataAccessException {
		return getSqlMapClientTemplate().queryForList("LogicWhCheckTaskItem_ex.findCheckTaskList", scs);
	}

}